x86: Fix handling of BSF and BSR instructions.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 22 Apr 2008 10:43:10 +0000 (11:43 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 22 Apr 2008 10:43:10 +0000 (11:43 +0100)
commitcad0afcc0898379d597ad3300d07ed738225ab50
treef29b662ca01bf8c7a2762562735319fb66fec4af
parentfd6c8de67e0d2199daf396005c1763d3bef4b1e5
x86: Fix handling of BSF and BSR instructions.

 1. We cannot rely on BSF/BSR leaving the destination register intact
    if the source is zero (according to Intel manuals)
 2. We race clear_bit() in find_first_bit(), which may occur after
    SCAS but before BSF. So we must handle zero input to BSF.

Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/bitops.c
xen/include/asm-x86/bitops.h